---
sidebar_position: 3
description: Learn how to read air pressure sensor data using
    `AirPressure` client. Subscribe to changes or read the data directly.
---

# Register

The `sensor` client exposes `pressure` register object.
We can read the register value to retreive the air pressure
sensor last reading. The reading is in `hPa` and should be around 1000.

## subscribe

```ts edit
const sensor = new ds.AirPressure()
// highlight-next-line
sensor.reading.subscribe(async pressure => {
    console.data({ pressure })
})
```

To apply filtering or thresholding on the changes, see [observables](/developer/observables).

## unsubscribe

The `subscribe` method returns an `unsubscribe` callback.

```ts edit
const sensor = new ds.AirPressure()
const unsubscribe = sensor.reading.subscribe(async pressure =>
    console.data({ pressure })
)

// cleanup
// highlight-next-line
unsubscribe()
```

## read

You can also read the sensor data using the `read` function.

```ts
const sensor = new ds.AirPressure()

// highlight-next-line
const pressure = await sensor.reading.read()
```
